<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>
 Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="popupmenu.js Overview";
	
}
</script>
</head>
<body bgcolor="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>popupmenu.js</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		No overview generated for 'popupmenu.js'<BR/><BR/>
	
</p>

<hr>



<!-- ========== METHOD SUMMARY =========== -->

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"><span class="comment">/*
  popupmenu.js - simple JavaScript popup menu library.

  Copyright (C) 2007 Jiro Nishiguchi &lt;jiro<span class="attrib">@cpan</span>.org&gt; All rights reserved.
  This is free software with ABSOLUTELY NO WARRANTY.

  You can redistribute it and/or modify it under the modified BSD license.

  Usage:
    var popup = new PopupMenu();
    popup.add(menuText, function(target){ ... });
    popup.addSeparator();
    popup.bind('targetElement');
    popup.bind(); // target is document;
*/</span>
var PopupMenu = <span class="reserved">function</span>() {
    <span class="reserved">this</span>.init();
}
PopupMenu.SEPARATOR = <span class="literal">'PopupMenu.SEPARATOR'</span>;
PopupMenu.current = null;
PopupMenu.addEventListener = <span class="reserved">function</span>(element, name, observer, capture) {
    <span class="reserved">if</span> (typeof element == <span class="literal">'string'</span>) {
        element = document.getElementById(element);
    }
    <span class="reserved">if</span> (element.addEventListener) {
        element.addEventListener(name, observer, capture);
    } <span class="reserved">else</span> <span class="reserved">if</span> (element.attachEvent) {
        element.attachEvent(<span class="literal">'on'</span> + name, observer);
    }
};
PopupMenu.<span class="reserved">prototype</span> = {
    init: <span class="reserved">function</span>() {
        <span class="reserved">this</span>.items  = [];
        <span class="reserved">this</span>.width  = 0;
        <span class="reserved">this</span>.height = 0;
    },
    setSize: <span class="reserved">function</span>(width, height) {
        <span class="reserved">this</span>.width  = width;
        <span class="reserved">this</span>.height = height;
        <span class="reserved">if</span> (<span class="reserved">this</span>.element) {
            var self = <span class="reserved">this</span>;
            with (<span class="reserved">this</span>.element.style) {
                <span class="reserved">if</span> (self.width)  width  = self.width  + <span class="literal">'px'</span>;
                <span class="reserved">if</span> (self.height) height = self.height + <span class="literal">'px'</span>;
            }
        }
    },
    bind: <span class="reserved">function</span>(element) {
        var self = <span class="reserved">this</span>;
        <span class="reserved">if</span> (!element) {
            element = document;
        } <span class="reserved">else</span> <span class="reserved">if</span> (typeof element == <span class="literal">'string'</span>) {
            element = document.getElementById(element);
        }
        <span class="reserved">this</span>.target = element;
        <span class="reserved">this</span>.target.oncontextmenu = <span class="reserved">function</span>(e) {
            self.show.call(self, e);
            <span class="reserved">return</span> false;
        };
        var listener = <span class="reserved">function</span>() { self.hide.call(self) };
        PopupMenu.addEventListener(document, <span class="literal">'click'</span>, listener, true);
    },
    add: <span class="reserved">function</span>(text, callback) {
        <span class="reserved">this</span>.items.push({ text: text, callback: callback });
    },
    addSeparator: <span class="reserved">function</span>() {
        <span class="reserved">this</span>.items.push(PopupMenu.SEPARATOR);
    },
    setPos: <span class="reserved">function</span>(e) {
        <span class="reserved">if</span> (!<span class="reserved">this</span>.element) <span class="reserved">return</span>;
        <span class="reserved">if</span> (!e) e = window.event;
        var x, y;
        <span class="reserved">if</span> (window.opera) {
            x = e.clientX;
            y = e.clientY;
        } <span class="reserved">else</span> <span class="reserved">if</span> (document.all) {
            x = document.body.scrollLeft + event.clientX;
            y = document.body.scrollTop + event.clientY;
        } <span class="reserved">else</span> <span class="reserved">if</span> (document.layers || document.getElementById) {
            x = e.pageX;
            y = e.pageY;
        }
        <span class="reserved">this</span>.element.style.top  = y + <span class="literal">'px'</span>;
        <span class="reserved">this</span>.element.style.left = x + <span class="literal">'px'</span>;
    },
    show: <span class="reserved">function</span>(e) {
        <span class="reserved">if</span> (PopupMenu.current &amp;&amp; PopupMenu.current != <span class="reserved">this</span>){<span class="comment">// return;</span>
        	PopupMenu.current.hide();
		}
        PopupMenu.current = <span class="reserved">this</span>;
        <span class="reserved">if</span> (<span class="reserved">this</span>.element) {
            <span class="reserved">this</span>.setPos(e);
            <span class="reserved">this</span>.element.style.display = <span class="literal">''</span>;
        } <span class="reserved">else</span> {
            <span class="reserved">this</span>.element = <span class="reserved">this</span>.createMenu(<span class="reserved">this</span>.items);
            <span class="reserved">this</span>.setPos(e);
            document.body.appendChild(<span class="reserved">this</span>.element);
        }
    },
    hide: <span class="reserved">function</span>() {
        PopupMenu.current = null;
        <span class="reserved">if</span> (<span class="reserved">this</span>.element) <span class="reserved">this</span>.element.style.display = <span class="literal">'none'</span>;
    },
    createMenu: <span class="reserved">function</span>(items) {
        var self = <span class="reserved">this</span>;
        var menu = document.createElement(<span class="literal">'div'</span>);
        with (menu.style) {
            <span class="reserved">if</span> (self.width)  width  = self.width  + <span class="literal">'px'</span>;
            <span class="reserved">if</span> (self.height) height = self.height + <span class="literal">'px'</span>;
            border     = <span class="literal">"1px solid gray"</span>;
            background = <span class="literal">'#FFFFFF'</span>;
            color      = <span class="literal">'#000000'</span>;
            position   = <span class="literal">'absolute'</span>;
            display    = <span class="literal">'block'</span>;
            padding    = <span class="literal">'2px'</span>;
            cursor     = <span class="literal">'default'</span>;
        }
        <span class="reserved">for</span> (var i = 0; i &lt; items.length; i++) {
            var item;
            <span class="reserved">if</span> (items[i] == PopupMenu.SEPARATOR) {
                item = <span class="reserved">this</span>.createSeparator();
            } <span class="reserved">else</span> {
                item = <span class="reserved">this</span>.createItem(items[i]);
            }
            menu.appendChild(item);
        }
        <span class="reserved">return</span> menu;
    },
    createItem: <span class="reserved">function</span>(item) {
        var self = <span class="reserved">this</span>;
        var elem = document.createElement(<span class="literal">'div'</span>);
        elem.style.padding = <span class="literal">'4px'</span>;
		elem.style.fontSize = <span class="literal">'12px'</span>;<span class="comment">//sheneyan 07.4.5</span>
        var callback = item.callback;
        PopupMenu.addEventListener(elem, <span class="literal">'click'</span>, <span class="reserved">function</span>(_callback) {
            <span class="reserved">return</span> <span class="reserved">function</span>() {
                self.hide();
                _callback(self.target);
            };
        }(callback), true);
        PopupMenu.addEventListener(elem, <span class="literal">'mouseover'</span>, <span class="reserved">function</span>(e) {
            elem.style.background = <span class="literal">'#B6BDD2'</span>;
        }, true);
        PopupMenu.addEventListener(elem, <span class="literal">'mouseout'</span>, <span class="reserved">function</span>(e) {
            elem.style.background = <span class="literal">'#FFFFFF'</span>;
        }, true);
        elem.appendChild(document.createTextNode(item.text));
        <span class="reserved">return</span> elem;
    },
    createSeparator: <span class="reserved">function</span>() {
        var sep = document.createElement(<span class="literal">'div'</span>);
        with (sep.style) {
            borderTop = <span class="literal">'1px dotted #CCCCCC'</span>;
            fontSize  = <span class="literal">'0px'</span>;
            height    = <span class="literal">'0px'</span>;
        }
        <span class="reserved">return</span> sep;
    }
};

</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Wed Aug  1 15:38:25 2007</div>
</body>
</html>
